package com.neutech.variable;

/**
 * break和continue关键字的区别
 * @author Neuedu-远哥
 * @version 1.0
 * @date 2021/11/10 10:59
 */
public class Demo11 {
    public static void main(String[] args) {
        Demo11 demo11 = new Demo11();
//        demo11.printInfoBreak();
        demo11.printInfoContinue();
    }

    public void printInfoBreak(){
        for (int i = 1; i <= 10; i++) {
            if(i == 5){
                // 跳出整个循环
                break;
            }
            System.out.println(i);
        }
    }
    public void printInfoContinue(){
        for (int i = 1; i <= 10; i++) {
            if(i == 5){
                // 跳出当前次循环
                continue;
            }
            System.out.println(i);
        }
    }
}
